package ingsw2.ii.dp.reader;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class MyWriter implements MyPrint{

	private BufferedWriter bw;
	
	public MyWriter(FileWriter out){
		bw = new BufferedWriter(out);
	}
	
	public MyWriter(String filename) throws IOException{
		bw = new BufferedWriter(new FileWriter(filename));
	}
	
	@Override
	public void write(String value) {
		try {
			bw.write(value);
			bw.newLine();
			bw.flush();
		} catch (Exception e) {
			System.err.println("Error while writing.");
		}
	}
	
}
